<?php

namespace D;

/**
 * Point2D
 *
 * Holds a position on a 2-dimensional plane
 *
 * @author Jonah Dahlquist <jonah[at]nucleussystems[dot]com>
 */
class Point2D
{
	/**
	 * The x dimension position
	 *
	 * @var double $x
	 */
	public $x = 0;
	
	/**
	 * The y dimension position
	 *
	 * @var double $y
	 */
	public $y = 0;
	
	/**
	 * Create a new Point2D
	 *
	 * @param double $x X dimension (optional, default 0)
	 * @param double $y Y dimension (optional, default 0)
	 */
	public function __construct($x = 0, $y = 0)
	{
		$this->x = $x;
		$this->y = $y;
	}
	
	/**
	 * Puts this Point object into a human-readable format
	 *
	 * @return string
	 */
	public function __toString()
	{
		return '{ x: ' . $this->x . ', y: ' . $this->y . ' }';
	}
}

